package com.zxp.springboot.service.impl;

import com.zxp.springboot.service.CalcService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.aop.framework.AopContext;
import org.springframework.aop.framework.AopProxy;
import org.springframework.aop.framework.AopProxyFactory;
import org.springframework.stereotype.Service;

/**
 * @author shollin
 * @desc
 * @date 2021/7/20/020 6:57
 */
@Service
@Slf4j
public class CalServiceImpl implements CalcService {

    @Override
    public int div(int x, int y) {
        int result = x / y;
        Object o = AopContext.currentProxy();
        log.info("动态代理对象：{} 执行结果：{}",o.getClass(), result);
        return result;
    }
}
